import { defineStore } from "pinia"
import { getCityAll } from "@/services";

const useCityStore = defineStore("city", {
    // state: () => {
    //     return {
    //         city: "shenzhen"
    //     }
    // },
    state: () => ({
        allCities: {},
        currentCity: { cityName: '深圳' }
    }),
    actions: {
        // fetchAllCitiesData: async () => {
        //     const res = await getCityAll()·
        //     this.allCities = res.data
        //     console.log(res);
        // }
        async fetchAllCitiesData() {
            const res = await getCityAll()
            this.allCities = res.data
            // console.log(res);
        }
    },
    getters: {

    }
})

export default useCityStore